<template>
	<AppButton
		type="primary"
		:class="{
			'app-control-form__button': true,
			[`app-control-form__button__${name}`]: true,
		}"
		@click="handleClick"
		:disabled="disabled"
	>
		<AppIconText
			:class="labelCssName"
			:iconClass="iconClass"
			:imgPath="imgPath"
			:textPSLanguageRes="textPSLanguageRes"
			:text="showCaption ? caption : ''"
		/>
	</AppButton>
</template>
<script setup lang="ts">
import { IEvent } from '@/core';
import { formButtonProps } from '../form';
const props = defineProps(formButtonProps);
interface ComponentEmit {
	(name: 'component-action', value: IEvent<string>): void;
}
const emit = defineEmits<ComponentEmit>();

const handleClick = (event: MouseEvent) => {
	emit('component-action', {
		name: props.name,
		action: 'formButtonAction',
		data: {
			actionType:props.actionType,
			event,
			logic: {
				name: props.name,
				actionTag: props.uIAction?.uIActionTag,
				actionDECodeName: props.uIAction?.actionDECodeName,
				predefinedType: props.uIAction?.predefinedType,
			},
		},
	});
};
</script>
